
<#include "header.ftl">
  <!-- 内容区域 -->
<div class="tpl-content-wrapper">

   <div class="container-fluid am-cf">
                <div class="row">
                     <div class="am-u-sm-12 am-u-md-12 am-u-lg-9">
                        <ol class="am-breadcrumb">
						  <li><a href="${Domain}my" class="am-icon-home">首页</a></li>
						  <li ><a href="${Domain}my/cure/list">治疗</a></li>
						  <li class="am-active">编辑</li>						  
						</ol>
                    </div>
                  	<#include "../common/return.ftl">
                </div>
</div>
  <div class="row-content am-cf">
  
  

          <div class="row">

                    <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
                        <div class="widget am-cf">
                            <div class="widget-head am-cf">
                                <div class="widget-title am-fl">编辑信息</div>
                                
                            </div>
                            <div class="widget-body am-fr">

                                <form class="am-form tpl-form-line-form"  method="post" action="${Domain}api/cure/update" id="cure-add" >
                                    
                                  <input type="hidden" id="id" name="id" value="${cure.id}">
                                   
                               
                            
                                    <div class="am-form-group">
                                        <label  class="am-u-sm-3 am-u-md-3 am-form-label">姓名 </label>
                                        <div class="am-u-sm-8 am-u-md-6">
                                            <input type="text" class="tpl-form-input" id="name" name="name" placeholder="请输入姓名" value="${patient.name}" required/>                                   
                                        </div>
                                          <label  class="am-u-sm-1 am-u-md-3"></label>
                                    </div>
                                    <div class="am-form-group">
                                        <label  class="am-u-sm-3 am-u-md-3 am-form-label">相关科室</label>
                                        <div class="am-u-sm-8 am-u-md-6 am-form-group tpl-table-list-select">
                                          <select data-am-selected="{btnWidth: '80%',searchBox: 1,btnSize: 'sm',maxHeight: 240}" name="departments" id="departments" multiple>
                                          <#list departments as item>
										  <option value="${item.id}"  <#list cure_departments as i><#if i.id==item.id>selected</#if></#list> >${item.name}</option> 
							              	</#list>			          
										 </select>

                                        </div>
                                          <label  class="am-u-sm-1 am-u-md-3"></label>
                                    </div>
                                     <div class="am-form-group">
                                        <label  class="am-u-sm-3 am-u-md-3 am-form-label">发病位置</label>
                                        <div class="am-u-sm-8 am-u-md-6 am-form-group tpl-table-list-select">
                                          <select data-am-selected="{btnWidth: '80%',searchBox: 1,btnSize: 'sm',maxHeight: 240}" name="places" id="places" multiple>
                                          <#list places as item>
										  <option value="${item.id}" <#list cure_places as i><#if i.id==item.id>selected</#if></#list>>${item.name}</option> 
							              	</#list>			          
										 </select>

                                        </div>
                                          <label  class="am-u-sm-1 am-u-md-3"></label>
                                    </div>
                                    <div class="am-form-group">
                                        <label  class="am-u-sm-3 am-u-md-3 am-form-label">治疗方式</label>
                                        <div class="am-u-sm-8 am-u-md-6 am-form-group tpl-table-list-select">
                                          <select data-am-selected="{btnWidth: '80%',searchBox: 1,btnSize: 'sm',maxHeight: 240}" name="treatments" id="treatments" multiple>
                                          <#list treatments as item>
										  <option value="${item.id}"  <#list cure_treatments as i><#if i.id==item.id>selected</#if></#list>>${item.name}</option> 
							              	</#list>			          
										 </select>

                                        </div>
                                          <label  class="am-u-sm-1 am-u-md-3"></label>
                                    </div>
                          		
                          		<div class="am-form-group">
                                        <label  class="am-u-sm-3 am-u-md-3 am-form-label">主管医生</label>
                                        <div class="am-u-sm-8 am-u-md-6 am-form-group tpl-table-list-select">
                                          <select data-am-selected="{btnWidth: '80%',searchBox: 1,btnSize: 'sm',maxHeight: 240}" name="users" id="users" multiple>
                                          <optgroup label="主任">
											<#list manages as item>
										  <option value="${item.id}" <#list cure_users as i><#if i.id==item.id>selected</#if></#list>>${item.name}</option> 
							              	</#list>
										</optgroup>	
										<optgroup label="医生">
											<#list doctors as item>
										  <option value="${item.id}" <#list cure_users as i><#if i.id==item.id>selected</#if></#list>>${item.name}</option> 
							              	</#list>
										</optgroup>
										<optgroup label="护士">
											<#list nurses as item>
										  <option value="${item.id}" <#list cure_users as i><#if i.id==item.id>selected</#if></#list>>${item.name}</option> 
							              	</#list>
										</optgroup>		          
										 </select>

                                        </div>
                                          <label  class="am-u-sm-1 am-u-md-3"></label>
                                    </div>
                                     <div class="am-form-group">
                                        <label  class="am-u-sm-3 am-u-md-3 am-form-label">确诊时间</label>
                                        <div class="am-u-sm-8 am-u-md-6">
                                           <input type="text" class="am-form-field" name="tdate" placeholder="确诊时间" value="${cure.tdate}" data-am-datepicker readonly required />
                                        </div>
                                         <label  class="am-u-sm-1 am-u-md-3"></label>
                                    </div>
                          			<div class="am-form-group">
                                        <label  class="am-u-sm-3 am-u-md-3 am-form-label">治疗时间</label>
                                        <div class="am-u-sm-8 am-u-md-6">
                                           <input type="text" class="am-form-field" name="startdate" placeholder="治疗时间" value="${cure.startdate}" data-am-datepicker readonly required />
                                        </div>
                                         <label  class="am-u-sm-1 am-u-md-3"></label>
                                    </div>
                          			<div class="am-form-group">
                                        <label  class="am-u-sm-3 am-u-md-3 am-form-label">出院时间</label>
                                        <div class="am-u-sm-8 am-u-md-6">
                                           <input type="text" class="am-form-field" name="enddate" placeholder="出院时间" value="${cure.enddate}" data-am-datepicker readonly required />
                                        </div>
                                         <label  class="am-u-sm-1 am-u-md-3"></label>
                                    </div>
                                    <div class="am-form-group">
                                        <label  class="am-u-sm-3 am-u-md-3 am-form-label">随访周期  </label>
                                        <div class="am-u-sm-8 am-u-md-6">
                                            <input type="number" class="tpl-form-input" id="cycle" name="cycle" value="${cure.cycle}" placeholder="请输入随访周期 （天）"  min="0" max="10000"/>                                   
                                        </div>
                                         <label  class="am-u-sm-1 am-u-md-3"></label>
                                    </div>
                                    <div class="am-form-group">
                                        <div class="am-u-sm-6 am-u-sm-push-3">
                                            <button type="submit" id="sub" class="am-btn page-header-button tpl-btn-bg-color-success am-btn-block">保存</button>
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
        
         
        
            
   </div>
</div>        

<script type="text/javascript">
  var loading; 
$(function() {
  
  $('#cure-add').validator({
    onValid: function(validity) {   
      $(validity.field).closest('.am-form-group').find('.am-alert').hide();
    },
    onInValid: function(validity) {
   
      var $field = $(validity.field);
      var $group = $field.closest('.am-form-group');
      var $tpl = $group.find('.tpl-form-input');
      var $alert = $group.find('.am-alert');
      // 使用自定义的提示信息 或 插件内置的提示信息
      var msg = $tpl.data('validationMessage') || this.getValidationMessage(validity);
      if (!$alert.length) {
        $alert = $('<div class="am-alert am-alert-danger"></div>').hide().
          insertAfter($tpl);
      }

      $alert.html(msg).show();
    }
  });
});
  
 
   $('#cure-add').ajaxForm({
	    beforeSubmit: function(a,f,o) {
	        loading=weui.loading('数据加载中...');
	    },
	    success: function(json) {	    	
	    	if(json.status)
	    	{
	    	  	if(loading)loading.hide();
	    		weui.toast(json.msg); 
	    		<#if ask.url??>
	    		location.href="${ask.url}";	
	    		</#if>		
	    	}else
	    	{	
	    		if(loading)loading.hide();
	    	    weui.alert(json.msg);  		 
	    	}
	    }
	});
	</script>
<#include "footer.ftl">